﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Goods;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Goods
{
    public class GoodsUpdateCommandHandler : IRequestHandler<GoodsUpdateCommand, int>
    {
        protected readonly IGoodService goodService;

        public GoodsUpdateCommandHandler(IGoodService goodService)
        {
            this.goodService = goodService;
        }

        public async Task<int> Handle(GoodsUpdateCommand request, CancellationToken cancellationToken)
        {
            return await goodService.GoodsUpd(new GoodsInfo() { GoodsName = request.GoodsName, BatchofProduction = request.BatchofProduction, EnterpriseOfProduction = request.EnterpriseOfProduction, ProductionLicense = request.ProductionLicense, GoodsPic = request.GoodsPic, ShelfLife = request.ShelfLife, AddName = request.AddName, AddTime = request.AddTime, GoodsInfoid = request.GoodsInfoid });
        }
    }
}
